//
//  UIViewExtension.swift
//  edu
//
//  Created by karlzhou on 15/12/10.
//  Copyright © 2015年 karlzhou. All rights reserved.
//

import Foundation
extension UIView{
    var size:CGSize?{
        get{
            return self.frame.size
        }
        set{
            var frame = self.frame
            print("size:\(newValue!)")
            frame.size = newValue!
            self.frame = frame
        }
    }
    var height:CGFloat{
        get{
            return self.frame.size.width
        }
        set{
            var frame = self.frame
            frame.size.width = newValue
            self.frame = frame
            
        }
    }
    var width:CGFloat{
        get{
            return self.frame.size.width
        }
        set{
            var frame=self.frame
            frame.size.width = newValue
            self.frame=frame
        }
    }
    
    var x:CGFloat{
        get{
            return self.frame.origin.x
        }
        set{
            var frame=self.frame
            frame.origin.x = newValue
            self.frame=frame
        }
    }
    
    var y:CGFloat{
        get{
            return self.frame.origin.y
        }
        set{
            var frame=self.frame
            frame.origin.y = newValue
            self.frame=frame
            
        }
    }
    
    var CenterY:CGFloat{
        get{
            return self.center.y
        }
        set{
            var pointer=self.center
            pointer.x = newValue
            self.center=pointer
        }
    }
    var CenterX:CGFloat{
        get{
            return self.center.y
        }
        set{
            var pointer=self.center
            pointer.y = newValue
            self.center=pointer
        }
    }
}